package com.youdianda.controller;

import com.youdianda.dto.SysMenuFgxDTO;
import com.youdianda.entity.SysFgxMenu;
import com.youdianda.result.Result;
import com.youdianda.service.SysMenuFgxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "权限管理")
@RequestMapping("/sys_menu")
@RestController
public class SysMenuFgxController {

    @Autowired
    private SysMenuFgxService sysMenuService;

    /**
     * GET 所有菜单
     * @return
     */
    @ApiOperation("GET 所有菜单")
    @GetMapping("/allData")
    public Result allData(){
        Result result = sysMenuService.allData();
        return result;
    }

    //update
    @ApiOperation("菜单修改")
    @PostMapping("/update")
    public Result update(@RequestBody SysFgxMenu sysMenu){
        Result result = sysMenuService.update(sysMenu);
        return result;
    }

    @ApiOperation("菜单详情")
    @GetMapping("/rowInfo")
    public Result rowInfo(Integer id){
        Result result = sysMenuService.rowInfo(id);
        return result;
    }

    @ApiOperation("菜单添加")
    @PostMapping("/add")
    public Result add(@RequestBody SysMenuFgxDTO dto){
        Result result = sysMenuService.add(dto);
        return result;
    }

    @ApiOperation("菜单删除")
    @GetMapping("/del")
    public Result del(Integer id){
        Result result = sysMenuService.del(id);
        return result;
    }

}
